<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="登记时间">
        <el-date-picker v-model="daterangeCreatedDate" style="width: 240px" value-format="yyyy-MM-dd" type="daterange"
          range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索
        </el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
          v-hasPermi="['report:removalreport:export']">导出
        </el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="removalreportList" @selection-change="handleSelectionChange">
      <el-table-column label="备案数量" align="center" prop="totalNum" />
      <el-table-column label="审核通过数" align="center" prop="passNum" />
      <el-table-column label="驳回数量" align="center" prop="rejectNum" />
      <!-- <el-table-column label="居住建筑" align="center" prop="liveNum"/>
      <el-table-column label="公共建筑" align="center" prop="publicNum"/>
      <el-table-column label="工业建筑" align="center" prop="industryNum"/>
      <el-table-column label="农业建筑" align="center" prop="agricultureNum"/> -->
    </el-table>
  </div>
</template>

<script>
import { listRemovalreport } from "@/api/report/removalreport";

export default {
  name: "Removalreport",
  dicts: ['approval_status', 'structure_type_id'],
  data () {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 拆迁项目统计表格数据
      removalreportList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 修改时间时间范围
      daterangeCreatedDate: [],
      // 查询参数
      queryParams: {
        current: 1,
        size: 10,
        createdDate: null,
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {}
    };
  },
  created () {
    this.getList();
  },
  methods: {
    /** 查询拆迁项目统计列表 */
    getList () {
      this.loading = true;
      this.queryParams.params = {};
      if (null != this.daterangeCreatedDate && '' != this.daterangeCreatedDate) {
        this.queryParams.params["beginCreatedDate"] = this.daterangeCreatedDate[0];
        this.queryParams.params["endCreatedDate"] = this.daterangeCreatedDate[1];
      }
      listRemovalreport(this.queryParams).then(response => {
        this.removalreportList = response.records;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel () {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset () {
      this.form = {
        id: null,
        projectId: null,
        buildingYear: null,
        buildingType: null,
        structureType: null,
        removalPeriod: null,
        buildingUse: null,
        constructionDept: null,
        constructionPerson: null,
        constructionPhone: null,
        removalDept: null,
        removalPerson: null,
        removalPhone: null,
        disposalLandId: null,
        disposalLandPerson: null,
        disposalLandPhone: null,
        transportCompanyId: null,
        transportCompanyPerson: null,
        transportCompanyPhone: null,
        transportCompanySuggestion: null,
        transportCompanyCarInfo: null,
        rubbishRemovalArea: null,
        rubbishHouseArea: null,
        rubbishPlanWeight: null,
        rubbishRecycleWeight: null,
        rubbishRecycleRatio: null,
        rubbishPlanTransportDate: null,
        classifyStage: null,
        recycleStage: null,
        classifyStageStartDate: null,
        classifyStageEndDate: null,
        recycleStageStartDate: null,
        recycleStageEndDate: null,
        projectImages: null,
        approvalStatus: 0,
        approvalDesc: null,
        approvalDate: null,
        createdDate: null,
        modifiedDate: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery () {
      this.queryParams.current = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery () {
      this.daterangeCreatedDate = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange (selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 导出按钮操作 */
    handleExport () {
      this.download('report/removalreport/export', {
        ...this.queryParams
      }, `removalreport_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
